// Copyright 2012 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package dfa.axis.v1_19;

import com.google.api.ads.dfa.axis.factory.DfaServices;
import com.google.api.ads.dfa.axis.v1_19.UserFilterCriteriaType;
import com.google.api.ads.dfa.axis.v1_19.UserRemote;
import com.google.api.ads.dfa.lib.client.DfaSession;

/**
 * This example displays user filter criteria type names and IDs.
 *
 * Credentials and properties in {@code fromFile()} are pulled from the
 * "ads.properties" file. See README for more info.
 *
 * Tags: user.getAvailableUserFilterCriteriaTypes
 *
 * @author Joseph DiLallo
 */
public class GetUserFilterCriteriaTypes {

  public static void runExample(DfaServices dfaServices, DfaSession session) throws Exception {
    // Request the user service.
    UserRemote userService = dfaServices.get(session, UserRemote.class);

    // Get user filter criteria types.
    UserFilterCriteriaType[] types = userService.getAvailableUserFilterCriteriaTypes();

    // Display user filter criteria types.
    for (UserFilterCriteriaType type : types) {
      System.out.printf("User filter criteria type with name \"%s\" and ID \"%s\" was found.",
         type.getName(), type.getId());
    }
  }

  public static void main(String[] args) throws Exception {
    // Construct a DfaSession.
    DfaSession session = new DfaSession.Builder()
        .fromFile()
        .build();

    DfaServices dfaServices = new DfaServices();

    runExample(dfaServices, session);
  }
}
